﻿using IronPython.Hosting;
using Microsoft.Scripting.Hosting;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace jiaobenPy
{
    public class Class1
    {
        public static void Test()
        {
            // 创建Python引擎


            ScriptEngine engine = Python.CreateEngine();


            // 执行简单的Python代码
            var scope = engine.CreateScope();
            engine.ExecuteAndWrap("import sys", scope);
            engine.ExecuteAndWrap("import os", scope);

            engine.Execute("print(\"Python 版本为：\", sys.version)", scope);


            //ScriptScope scope = engine.CreateScope();


            //engine.Execute("x = 42", scope);


            //dynamic x = scope.GetVariable("x");


            //Console.WriteLine(x);
        }
    }
}
